﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class s_svr : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string cmd = GetParamV("cmd");

        string retStr = "";

        if (cmd == null)
        {
            retStr = "ResponseCode:CmdError";
        }
        else if (!SessionManage.IsUserLogIn && cmd != "10001")
        {
            retStr = "ResponseCode:SessionOverDue";
        }
        else
        {
            switch (cmd)
            {
                case "10000":   // 验证用户是否存在
                    try
                    {
                        string uid = Request["u"].ToString();

                        if (BHBC.BC.User.UserReg.CheckUserExist(uid) == 0)
                        {
                            // 检查离线消息
                            retStr = "0";
                        }
                        else
                            retStr = "1";
                    }
                    catch (Exception ex)
                    {
                        retStr = "ResponseCode:Exception";
                    }
                    break;
                default:
                    retStr = "ResponseCode:ParamError";
                    break;
            }
        }

        Response.Expires = 0;
        Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
        Response.CacheControl = "no-cache";
        Response.Write(retStr);
    }

    //获取页面参数
    public string GetParamV(string param)
    {
        return Request[param] == null ? "" : Request[param].ToString();
    }
}
